package com.hopu.v1.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hopu.v1.pojo.common.Save;
import com.hopu.v1.pojo.common.Update;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDate;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ClassVo {

    /**
     * 班级id
     */
    private Integer id;

    /**
     * 班级名称
     */
    @Length(message = "班级名不低于6位", min = 6, groups = Save.class)
    @Pattern(regexp = "^[a-zA-Z][a-zA-Z0-9]{5,9}$",message = "格式不正确",groups = {Save.class, Update.class})
    @NotBlank(message = "班级名不能为空",groups = Save.class)
    private String className;

    /**
     * 班级描述
     */
    private String classDescription;

    /**
     * 学科id
     */
    @NotEmpty(message = "学科不能为空",groups = {Save.class, Update.class})
    private Integer subjectId;

    /**
     * 班级状态
     */
    private Integer classStatus;

    /**
     * 开班日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate startDate;

    /**
     * 班主任id
     */
    @NotEmpty(message = "教师不能为空",groups = {Save.class, Update.class})
    private Integer teacherId;

    /**
     * 教员id
     */
    @NotEmpty(message = "教员不能为空",groups = {Save.class, Update.class})
    private Integer staffId;

    /**
     * 结业日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDate endDate;

    /*教员姓名*/
    @Length(message = "姓名不低于2位", min = 2, groups = {Save.class, Update.class})
    @Pattern(regexp = "^[a-zA-Z0-9]|[\\u4e00-\\u9fa5]{2,10}$",message = "格式不正确",groups = {Save.class, Update.class})
    @NotBlank(message = "姓名不能为空",groups = {Save.class, Update.class})
    private String realName;

    /*班主任姓名*/
    @Length(message = "姓名不低于2位", min = 2, groups = {Save.class, Update.class})
    @Pattern(regexp = "^[a-zA-Z0-9]|[\\u4e00-\\u9fa5]{2,10}$",message = "格式不正确",groups = {Save.class, Update.class})
    @NotBlank(message = "姓名不能为空",groups = {Save.class, Update.class})
    private String teacherName;

    /*学科名*/
    @Length(message = "姓名不低于2位", min = 2, groups = {Save.class, Update.class})
    @Pattern(regexp = "^[a-zA-Z0-9]|[\\u4e00-\\u9fa5]{2,20}$",message = "格式不正确",groups = {Save.class, Update.class})
    @NotBlank(message = "不能为空",groups = {Save.class, Update.class})
    private String subjectName;

    /*学生总人数*/
    private Integer classCount;

}
